<?php
/**
 * Created by PhpStorm.
 * User: aDaddy
 * Date: 2016/7/25
 * Time: 9:55
 */

namespace Model\TeacherBundle\Model;
use Base\BaseModel;

class TeacherApplySchoolModel extends BaseModel{

    /**
     * @param $teacherId
     * @return mixed
     */
    public function getByTeacherId($teacherId)
    {
        $qb = $this->getQueryBuilder();
        $qb->select("*")->from("TeacherApplySchool");
        $qb->where("teacherId = ?")->setParameter(0,$teacherId);
        return $qb->execute()->fetch();
    }

    /**
     * @param $schoolId
     * @param $status
     * @return mixed
     */
    public function getBySchoolId($schoolId , $status = 0)
    {
        $qb = $this->getQueryBuilder();
        $qb->select("*")->from("TeacherApplySchool");
        $qb->where("schoolId = ?")->setParameter(0,$schoolId);
        $qb->andWhere("status = ?")->setParameter(1,$status);
        return $qb->execute()->fetchAll();
    }
}